package com.nuoniu.sibanyun.mapper.erp.in;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nuoniu.sibanyun.entity.erp.in.InInventoryUnitGroup;
import com.nuoniu.sibanyun.entity.vo.InInventoryUnitGroupVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author baiqiang
 * @since 2020-11-23
 */
public interface InInventoryUnitGroupMapper extends BaseMapper<InInventoryUnitGroup> {

    @Select("SELECT\n" +
            "\tug.`name` AS unit_group_name,\n" +
            "\tu.`name` as unit_name,\n" +
            "\tu.id as unit_id,\n" +
            "\tu.convert_type,\n" +
            "\tu.is_main_unit,\n" +
            "\tig.change_rate,\n" +
            "\tig.id\n" +
            "FROM\n" +
            "\tin_inventory_unit_group ig\n" +
            "\tINNER JOIN scb_unit u ON u.id = ig.unit_id\n" +
            "\tINNER JOIN scb_unit_group ug ON ug.id = u.unit_group_id\n" +
            "\tWHERE ig.company_id = #{ companyId } AND ig.inventory_id = #{ inInventoryId }")
    List<InInventoryUnitGroupVo> listInInventoryUnitGroupVo(Integer companyId ,Integer inInventoryId);

}
